package com.bole.springboot_webflux;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.reactive.function.server.*;
import reactor.core.publisher.Mono;

@SpringBootApplication
public class SpringbootWebfluxApplication {

	public static void main(String[] args) {
		SpringApplication.run(SpringbootWebfluxApplication.class, args);
	}


	/**
	 * ② 通过函数式编程
	 */
	@Bean
	public RouterFunction<ServerResponse> routes(){

		return RouterFunctions.route().GET("/func/greeting", request -> ServerResponse.ok().bodyValue("hello webflux by function")).build();

	}





}
